<?php

namespace app\middleware;

class JumpOutLogin
{
    
    public function handle($request, \Closure $next,$doing)
    {
        if (cookie('token') != '') {
            if ($doing == 'redirect') {
                return redirect('/');
            } else {
                return json(['msg'=>'请先登录']);
            }
        }

        return $next($request);
    }
}